<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<meta name=viewport content="with=device-width,initial-scale=1.0">
<link href="../resource/bootstrap/css/bootstrap.min.css"
	rel="stylesheet">
<link href="../resource/css/basic.css" rel="stylesheet">
<script src="../resource/js/jquery.min.js"></script>
<script src="../resource/bootstrap/js/bootstrap.min.js"></script>
<script src="../resource/js/user.js"></script>
<script>
	$(function() {
		$('#btnLogout').click(logout);
		$('#lessonList>a').click(function(event) {
			var $user = $(this);
			$user.siblings().removeClass('active');
			$user.addClass('active')
		});
		$('#lessonList>a[data-id]').click(getSubscribeUserList);
		$('#studentList td>a[data-type=show]').click(getStudentInfoByTeacher);
		$('#studentList td>button[data-type]').click(auditByTeacher);
	});
</script>
<title>学生管理</title>
</head>
<body>
	<nav class="navbar navbar-fixed-top navbar-primary" role="navigation">
		<div class="container-fluid">
			<div class="navbar-header">
			<img class="img-responsive" src="../resource/image/header3.png" />
		</div>
			<ul class="user nav navbar-nav navbar-right">
				<li><a href="#">欢迎您， <img class="img-circle"
						style="height: 18px" src="${teacher.logo }" /> ${teacher.petName}
				</a></li>
				<li><a href="#"><i class="glyphicon glyphicon-comment"></i>
						我 的 消 息</a></li>
				<li><a id="btnLogout" href="#" data-roles="teacher"><i
						class="glyphicon glyphicon-off"></i> 退 出 登 录</a></li>
			</ul>
		</div>
	</nav>
	<div>
		<div class="col-sm-2">
			<div class="row panel panel-default">
				<div class="panel-body">
					<div class="row panel panel-default">
						<div class="panel-body">
							<div class="list-group">
								<a class="list-group-item" href="../teacher"><i
									class="glyphicon glyphicon-user"></i> 首页导航</a>
							</div>
							<div class="list-group">
								<a class="list-group-item active" href="studentInfo"><i
									class="glyphicon glyphicon-user"></i> 学生管理</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="lessonInfo"><i
									class="glyphicon glyphicon-book"></i> 课程管理 <span class="badge">2</span></a>
								<a class="list-group-item" href="publishLesson"><i
									class="glyphicon glyphicon-edit"></i> 课程发布</a> <a
									class="list-group-item" href="publishLessonContent"><i
									class="glyphicon glyphicon-edit"></i> 课题发布</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="resourceUpload"><i
									class="glyphicon glyphicon-cloud-upload"></i> 资料上传</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="publishExam"><i
									class="glyphicon glyphicon-dashboard"></i> 考试发布</a>
							</div>
							<div class="list-group">
								<a class="list-group-item" href="#"><i
									class="glyphicon glyphicon-tag"></i> 题库管理 <span class="badge">1</span></a>
								<a class="list-group-item" href="#"><i
									class="glyphicon glyphicon-pencil"></i> 添加答题</a>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
		<div class="col-xs-10">
			<div class="row panel panel-default">
				<div class="panel-heading">
					<ol class="breadcrumb">
						<li><a href="../teacher"><i class="glyphicon glyphicon-home"></i>
								首页</a></li>
						<li class="active"><i class="glyphicon glyphicon-user"></i>学生管理</li>
					</ol>
				</div>
				<div class="panel-body">
					<div class="panel panel-default">
						<div class="panel-heading">学生管理</div>
						<div class="panel-body">
							<div class="col-xs-3">
								<div class="panel panel-danger">
									<div id="lessonList" class="list-group">
										<c:forEach items="${lessonList}" var="ll" varStatus="status">
											<c:choose>
												<c:when test="${status.first }">
													<a class="list-group-item active" href="#lesson${ll.id }"
														data-toggle="tab">${ll.title }</a>
												</c:when>
												<c:otherwise>
													<a class="list-group-item" href="#lesson${ll.id }"
														data-toggle="tab" data-id="${ll.id }">${ll.title }</a>
												</c:otherwise>
											</c:choose>
										</c:forEach>
									</div>
								</div>
							</div>
							<div class="col-sm-9 panel panel-default">
								<div id="studentList" class="panel-body tab-content">
									<div id="lesson${lessonList[0].id }"
										class="tab-pane fade active in">
										<table class="table table-striped table-bordered table-hover">
											<tr>
												<th>ID</th>
												<th>账户</th>
												<th>学生</th>
												<th>订阅时间</th>
												<th>状态</th>
												<th>操作</th>
											</tr>
											<c:forEach items="${studentList}" var="sl">
												<tr data-id="${sl.id}">
													<td>${sl.id}</td>
													<td>${sl.user.userNum}</td>
													<td>${sl.user.petName }</td>
													<td>${fn:substring(sl.createDate,0,19)}</td>
													<c:choose>
														<c:when test="${sl.state == 0 }">
															<td class="text-danger">未通过</td>
														</c:when>
														<c:when test="${sl.state == 1 }">
															<td class="text-warning">待审核</td>
														</c:when>
														<c:otherwise>
															<td class="text-success">审核通过</td>
														</c:otherwise>
													</c:choose>
													<td><a class="btn btn-danger btn-xs" href="#"
														data-type="show"><i
															class="glyphicon glyphicon-info-sign"></i></a>
														<button class="btn btn-success btn-xs" type="button"
															data-type="2">
															<i class="glyphicon glyphicon-ok"></i>
														</button>
														<button class="btn btn-danger btn-xs" type="button"
															data-type="0">
															<i class="glyphicon glyphicon-remove"></i>
														</button></td>
												</tr>
											</c:forEach>
										</table>
									</div>
								</div>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
	</div>
</body>
</html>